import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';

export const secuApi = createApi({
    baseQuery: fetchBaseQuery({
        baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL
    }),
    reducerPath: 'secuApi',
    keepUnusedDataFor: 0,
    tagTypes: ['Brief'],
    endpoints: (builder) => ({
        getBriefs: builder.query({
            query: (secuCode) => ({
                url: `/secu/brief/${secuCode}`,
                method: 'GET'
            }),
            providesTags: ['Brief']
        })
    })
});

export const { useGetBriefsQuery } = secuApi;
